package net.tngou.crawler.http;



import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.Cookie;



import org.apache.commons.lang3.time.DateUtils;

import net.tngou.crawler.cache.CacheEngine;
import net.tngou.crawler.cache.EhCacheEngine;





/**
 * 这里我们主要用的的ehcache来代替传统的session
 * @author 陈磊
 *
 */

public class SessionContext  implements net.tngou.crawler.http.HttpSession {

	
	private static CacheEngine cacheEngine =new  EhCacheEngine().getInstance();
	private final String fullyQualifiedName = "session";
	@Override
	public void setAttribute(String name, Object value)
	{
		
		cacheEngine.add(fullyQualifiedName, name, value);
	}

	@Override
	public void removeAttribute(String name)
	{
		cacheEngine.remove(fullyQualifiedName, name);
	}

	@Override
	public Object getAttribute(String name)
	{
		return cacheEngine.get(fullyQualifiedName, name);
	}

	

	
	

}
